//关系运算符重载
#include <iostream>
using namespace std;
class Person{
public:
    int x;
    string name;
    Person(int x=0,string name="null"){
        this->x=x;
        this->name=name;
    }
    //==运算符的重载
    bool operator==(Person p){
        if((this->name==p.name)&&(this->x==p.x)){
            return true;
        }
        else{
            return false;
        }
    }
    //!=运算符的重载
    bool operator!=(Person p){
        if((this->name!=p.name)||(this->x!=p.x)){
            return true;
        }
        else{
            return false;
        }
    }
};
//<<的重载
ostream& operator<<(ostream &cout,Person p){
    cout<<p.x<<endl;
    cout<<p.name<<endl;
    return cout;
}
int main()
{
    Person p1(18,"张三");
    Person p2(19,"李四");
    cout<<p1<<endl;
    if(p1!=p2){
        cout<<"true"<<endl;
    }
    else{
        cout<<"flase"<<endl;
    }
    return 0;
}